import { asyncRoutes, constantRoutes } from '@/router/index'

const state = {
  router: []
}
const mutations = {
  MenutsFn(state, data) {
    state.router = [
      ...data,
      ...constantRoutes]
  }
}
const actions = {
  filterMents(store, ments) {
    // [].includes
    // console.log(ments)
    const res = asyncRoutes.filter(item => ments.includes(item.name))
    // console.log(res)
    store.commit('MenutsFn', res)
    return res
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
